section .data
msg:   db     "Hello, world from YASM", 10
.len:  equ    $ - msg
 
section .text
global YASM_HelloWorld
YASM_HelloWorld:
    push   rbp ; create stack frame
    mov rbp, rsp
    
    mov    eax, 4 ; write
    mov    ebx, 1 ; stdout
    mov    ecx, msg
    mov    edx, msg.len
    int    0x80
    
    ;These lines cause premature program termination
    ;mov    eax, 1 ; exit
    ;mov    ebx, 0      
    ;int    0x80
    
    pop rbp ; restore the base pointer
    ret